package com.test.queue;

import java.util.Vector;

public class MsgQueue {

	private Vector queue = null;

	public MsgQueue() {
		queue = new Vector();
	}

	public synchronized void send(Object o) {
		queue.addElement(o);
	}

	public synchronized Object recv() {
		if (queue.size() == 0)
			return null;
		Object o = queue.firstElement();
		queue.removeElementAt(0);// or queue[0] = null can also work
		return o;
	}
}